package dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import dao.GetUserIdByUsernameDao;
import entity.User;
import entity.User_Inf;
import util.C3P0Util;

public class GetUserIdByUsernameDaoImpl implements GetUserIdByUsernameDao {

	@Override
	public User_Inf getUserIdByUsername(String username) {
		User_Inf user_Inf=null;
		QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());
		String sql = "select * from `user_inf` where username = ? ";
		try {
			user_Inf = qr.query(sql, username,new BeanHandler<User_Inf>(User_Inf.class));
		} catch (SQLException e) {
			e.printStackTrace();
		}		
		return user_Inf;
	}
}